package com.hz.web.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hz.web.dao.CreditCommitmentDao;
import com.hz.web.entity.CreditCommitmentEntity;
import com.hz.web.service.IcreditCommitmentService;
import com.hz.web.util.Uid;

@Service
public class CreditCommitmentImpl implements IcreditCommitmentService {

	@Resource
	private CreditCommitmentDao creditCommitmentDao;
	
	/**
	 * 查询信用承诺信息
	 * @param parmsMap
	 * @return
	 */
	@Override
	public List<CreditCommitmentEntity> queryCreditCommitment(
			Map<String, Object> parmsMap) {
		
		return creditCommitmentDao.queryCreditCommitment(parmsMap);
	}

	/**
	 * 查询信用承诺信息总条数
	 * @param parmsMap
	 * @return
	 */
	@Override
	public int queryCreditCommitmentCount(Map<String, Object> parmsMap) {
		
		return creditCommitmentDao.queryCreditCommitmentCount(parmsMap);
	}

	/**
	 * 添加信用承诺信息
	 * @param entity
	 * @return
	 */
	@Override
	public int addCreditCommitment(CreditCommitmentEntity entity) {
		if(entity==null){
			return -1;
		}
		entity.setSysId(Uid.getUid());
		return creditCommitmentDao.addCreditCommitment(entity);
	}

	/**
	 * 修改信用承诺信息
	 * @param entity
	 * @return
	 */
	@Override
	public int updateCreditCommitment(CreditCommitmentEntity entity) {
	
		return creditCommitmentDao.updateCreditCommitment(entity);
	}

	/**
	 * 根据部门编码修改部门名称（部门没有编码，取的部门ID）
	 * @param parmsMap
	 * @return
	 */
	@Override
	public int updateCreditCommitmentByCode(Map<String, Object> parmsMap) {
		
		return creditCommitmentDao.updateCreditCommitmentByCode(parmsMap);
	}

}
